package org.bonorsoft.modules.system.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bonorsoft.modules.system.entity.SysDictItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 对应字典类别下的字典值
 * @Author: WilliamYe
 * @Date: 2020-11-18
 * @Version: V1.0
 */
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {

    /**
     * 根据字典类型查询字典数据
     *
     * @param dictType 字典类型
     * @return 字典数据集合信息
     */
    public List<SysDictItem> selectDictDataByType(String dictType);

    /**
     * 功能描述:根据type获取学校办学类型
     *
     * @vison: 1.0.0
     * @Author: WilliamYe
     * @Date: 2020/11/25 22:41
     */
    @Select("select item_text from sys_dict_item where item_value = #{schoolType}")
    public String getSchoolType(String schoolType);

    @Select("select item_text from sys_dict_item where item_value = #{learnType} and DICT_ID = #{dictId}")
    String getLearnType(String learnType, String dictId);

    @Select("select item_text from sys_dict_item " +
            "where dict_id = (select id from sys_dict where dict_code = #{table} ) " +
            "and item_value = #{key} ")
    String getValueByTableAndKey(String table, String key);
}
